package code.ws_common_utils
{
	import flash.utils.Dictionary;

	/**
	 * 全局EnterFrame实时刷新的方法维护类 
	 * @author qiangchen
	 * 
	 */	
	public class EnterFrameUtils
	{
		/** 池 */
		private static var _fnDic:Dictionary = new Dictionary();
		
		/**
		 * 注册 
		 * @param type
		 * @param fn
		 * 
		 */		
		public static function add( type:String, fn:Function ):void
		{
			if( type == null || type == "" ) return;
			
			if( _fnDic[type] )	return;
			
			_fnDic[type] = fn;
		}
		
		/**
		 * 获取 
		 * @param type
		 * @return 
		 * 
		 */		
		public static function get( type:String ):Function
		{
			return _fnDic[type];
		}
		
		/**
		 * 删除 
		 * @param type
		 * 
		 */		
		public static function del( type:String ):void
		{
			if( type == null || type == "" )
			{
				return;
			}
			
			_fnDic[type] = null;
			delete _fnDic[type];
		}
		
		/**
		 * 获取方法池 
		 * @return 
		 * 
		 */		
		public static function get fnDic():Dictionary
		{
			return _fnDic;
		}
	}
}